package com.iweb.web.controller;

import com.iweb.commons.utils.ModelAndView;
import com.iweb.pojo.Merchant;
import com.iweb.service.MerchantService;

import javax.servlet.http.HttpSession;

/**
 * @author: jack
 * @date: 2022-08-05 0005
 * @ApiNOTE:
 */
public class MerchantController {

  private MerchantService merchantService;

  public void setMerchantService(MerchantService merchantService) {
    this.merchantService = merchantService;
  }

  public ModelAndView merchantInfo(HttpSession session) {

    // 获取 在线用户
    Integer empId = Integer.parseInt(session.getAttribute("emp_id").toString());
    Merchant merchant = merchantService.findMerchant(empId);
    ModelAndView mv = new ModelAndView();
    mv.setViewName("/WEB-INF/views/merchant.jsp");
    mv.addModel("merchant", merchant);
    return mv;
  }
}
